const mysql  = require('mysql2/promise');
const {connection} = require('./common');
async function searchCircle(data){
    let obj = data;
    let str = '';
    delete obj.current;
    delete obj.pageSize;
    delete obj.sta
    for(let i in obj){
      str = str + `${i} Like'%${obj[i]}%' and `
    }
    let x = str.slice(0,str.length-5);
    let sql = `select * from examcircle where ${x}`;
    let res = await connection.execute(sql);
    return JSON.stringify(res[0]);
}

module.exports = {searchCircle}